package com.lvmama.rhino.pojo.comment.Enum;

/**
 * 错误码
 */

public enum EnumForResponse {

    LOGIN_EXPIRE("000001", "登录超时");

    private String code;
    private String msg;

    EnumForResponse(String code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    /**
     * 根据code获取枚举名称
     *
     * @param code
     * @return
     */
    public static String getResponseName(String code) {
        for (EnumForResponse en : EnumForResponse.values()) {
            if (en.getCode().equals(code)) {
                return en.getMsg();
            }
        }
        return null;
    }

}
